<template>
    <div class="mui-numbox shopNumBox_container" data-numbox-min='1' data-numbox-max='999'>
        <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
        <input id="test" class="mui-input-numbox" type="number" :value="initCount" 
            @change="numChange" ref="count" readonly/>
        <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
    </div>
</template>

<script>
import mui from '../../lib/mui/js/mui.min.js'
export default {
    data () {
        return {
            
        }
    },
    mounted() {
        mui('.mui-numbox').numbox()
    },
    methods: {
        numChange() { //购物车数量改变
            this.$store.commit('updateCarCount', {id: this.id, count: this.$refs.count.value})
        }
    },
    props: ['initCount','id']
}
</script>

<style lang="scss" scoped>
    .shopNumBox_container{
        height: 25px;
    }
</style>
